#!/bin/sh

max_days_ago=6
[ -n "$1" ] && max_days_ago=$1
for days in $(seq "$max_days_ago" -1 0); do
    datestring="$days days ago"
    case "$datestring" in
        "0 days ago") datestring=today ;;
        "1 days ago") datestring=yesterday
    esac
    date=$(date +"%Y-%m-%d" -d "$datestring")

    echo "\n"$(date +"%b %a %d" -d "$datestring")" ($datestring)\n"
    today "$date"
done
